package com.retry.rabbit.controller;

import com.retry.rabbit.config.DirectConfig;
import com.retry.rabbit.config.ErrorConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SendMessage {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    @RequestMapping("/send")
    public String sendMessage(){
        //                              交换机名称                   路由key，但fanout没有  消息体
        rabbitTemplate.convertAndSend(DirectConfig.RETRY_EXCHANGE,DirectConfig.RETRY_ROUTE_KEY,"direct message");
        return "success";
    }
}
